//
//  PicPikerViewCell.swift
//  weibo
//
//  Created by 叶子韬韬 on 2017/5/9.
//  Copyright © 2017年 叶子韬韬. All rights reserved.
//

import UIKit

class PicPikerViewCell: UICollectionViewCell {
    
    @IBAction func removePhotoClick(_ sender: Any) {
        
        NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: PicPikerRemovePhoto), object: image)
        
    }
    @IBOutlet weak var removeBtn: UIButton!
    @IBOutlet weak var addPhotoBtn: UIButton!
    
    
    @IBAction func addPhotoClick(_ sender: Any) {

        NotificationCenter.default.post(name: NSNotification.Name.init(rawValue: PicPikerAddPhoto), object: nil)
    }

    var image :UIImage?{
        didSet{
            if image != nil {
                addPhotoBtn.setBackgroundImage(image, for: .normal)
                addPhotoBtn.isUserInteractionEnabled = false
                removeBtn.isHidden = false
            }else{
                addPhotoBtn.setBackgroundImage(UIImage(named: "compose_pic_add"), for: .normal)
                addPhotoBtn.isUserInteractionEnabled = true
                removeBtn.isHidden = true
            }
        }
    }
    
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

}
